<?php
namespace App\Module\Admin\Controller;

use App\Common\Controller\AbstractController;
use App\Module\Admin\Request\Foot\CreateRequest;
use App\Module\Admin\Request\Foot\UpdateRequest;
use App\Module\Admin\Service\FootService;
use Hyperf\Di\Annotation\Inject;

class FootController extends AbstractController{

    /**
     * @Inject()
     * @var FootService $footService
     */
    private $footService;

    public function search(){
        $child_id = $this->request->input("child_id");
        $child_name = $this->request->input("child_name");
        $is_public = $this->request->input("is_public");
        $is_excellent = $this->request->input("is_excellent");
        $source = $this->request->input("source");
        $source_name = $this->request->input("source_name");
        $start_time = $this->request->input("start_time");
        $end_time = $this->request->input("end_time");
        $pagesize = $this->request->input("pagesize");

        return $this->response->json($this->footService->search($child_id,$child_name,$is_public,$is_excellent,$source,$source_name,$start_time,$end_time,$pagesize));
    }

    public function add(CreateRequest $request){
        return $this->response->json($this->footService->create($request));
    }

    public function getById(int $id){
        return $this->response->json($this->footService->getById($id));
    }

    public function edit(UpdateRequest $request,int $id){
        return $this->response->json($this->footService->update($request,$id));
    }

    public function delete(int $id){
        return $this->response->json($this->footService->delete($id));
    }

    public function excellent(int $id){
        return $this->response->json($this->footService->excellent($id));
    }
}